//
//  WeexButton.m
//  Shelves
//
//  Created by mac on 2017/11/2.
//  Copyright © 2017年 上海LOL信息科技有限公司. All rights reserved.
//

#import "WeexButton.h"

@interface WeexButton()

@property (nonatomic,strong) UIButton *innerButton;
@property (nonatomic,strong) NSString *title;

@end

@implementation WeexButton

-(instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance{
    self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
    if (self) {
        _title = [WXConvert NSString:attributes[@"title"]];
    }
    return self;
}

-(void)viewDidLoad{
    [super viewDidLoad];
    self.innerButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.innerButton.frame = self.view.bounds;
    [self.view addSubview:self.innerButton];
    [self.innerButton setTitle:self.title forState:UIControlStateNormal];
    [self.innerButton addTarget:self action:@selector(onButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}

-(void)onButtonClick:(UIButton *)sender{
    DEF_DEBUG(@">>>>>%@",sender);
}

@end
